#include "stdafx.h"

#include <assert.h>
#include <memory.h>

#include <string>
using namespace std;

#include "UDPSearch.h"
SConfigRead::SConfigRead()
{
    m_wCmdID = CMD_ID_INVALID;
    memset(m_vbtDestMac, 0, sizeof(m_vbtDestMac));
    strcpy((char *)m_vbtData, "0123456789:;<=>?@ABCDEFGHIJKLMN");
}
SConfigRead::~SConfigRead()
{
}
int SConfigRead::Encode(unsigned char * pBuf, int nLen)
{
    if(nLen < MAX_PACKET_SIZE)
    {
        return -1;
    }

    unsigned char * pData = pBuf;
    *(unsigned short *)pData = m_wCmdID;
    pData += sizeof(unsigned short);

    memcpy(pData, m_vbtDestMac, sizeof(m_vbtDestMac));
    pData += sizeof(m_vbtDestMac);

    memcpy(pData, m_vbtData, sizeof(m_vbtData));
    pData += sizeof(m_vbtData);

    return (pData - pBuf);
}
SConfigSetEx::SConfigSetEx()
{
    m_nCmd_id = 0x0000;
    memset(m_bDes_mac, 0, sizeof(m_bDes_mac));
    memset(m_bSync, 0, sizeof(m_bSync));
    memset(m_bSrc_mac, 0, sizeof(m_bSrc_mac));
    memset(m_bLocal_mac, 0, sizeof(m_bLocal_mac));
    memset(m_bMask, 0, sizeof(m_bMask));
    memset(m_bGateway, 0, sizeof(m_bGateway));
    memset(m_bRemote_ip, 0, sizeof(m_bRemote_ip));
    m_nLocal_port = 0;
    m_nRemote_port = 0;
    m_bBandrate = 0;
    m_bIs_tcp = 0;
    m_bIs_server = 0;
    m_bDev_id = 0;
    m_bIs_getted = false;
}
SConfigSetEx::~SConfigSetEx()
{

}
